package com.aiyige.model;

import android.text.TextUtils;

import com.aiyige.MyApp;
import com.aiyige.R;

import java.util.Arrays;
import java.util.List;

/**
 * Created by xiachao on 2018/1/23.
 */

public class Subject {

    /**
     * 图集
     */
    public final static String photo = "photo";

    /**
     * 视频
     */
    public final static String video = "video";

    /**
     * 资讯文章
     */
    public final static String article = "article";

    /**
     * 专题
     */
    public final static String special_topic = "special_topic";

    /**
     * 教学视频
     */
    public final static String video_course = "video_course";

    /**
     * 专业课程
     */
    public final static String major_course = "major_course";

    /**
     * 培训班
     */
    public final static String training_course = "training_course";

    /**
     * 培训卡
     */
    public final static String training_card = "training_card";

    /**
     * 私教
     */
    public final static String private_course = "private_course";


    /**
     * 动态
     */
    public final static String dynamic = "dynamic";

    /**
     * 动态三合一（视频、文章、图片）
     */
    public final static String activity = "activity";

    /**
     * 通用商品（目前服务器没有此字段20180131 xiachao）
     */
    public final static String common_goods = "common_goods";


    public static String getSubjectName(String subject) {
        if (subject.equals(dynamic) || subject.equals(activity)) {
            return MyApp.getInstance().getStringById(R.string.dynamic_display);
        } else if (subject.equals(Subject.video_course)) {
            return MyApp.getInstance().getStringById(R.string.learn_video);
        } else if (subject.equals(Subject.video)) {
            return MyApp.getInstance().getStringById(R.string.video);
        } else if (subject.equals(Subject.photo)) {
            return MyApp.getInstance().getStringById(R.string.publish_photo);
        } else if (subject.equals(Subject.article)) {
            return MyApp.getInstance().getStringById(R.string.article);
        } else if (subject.equals(Subject.major_course)) {
            return MyApp.getInstance().getStringById(R.string.major_course);
        } else if (subject.equals(Subject.training_course)) {
            return MyApp.getInstance().getStringById(R.string.training_class);
        } else if (subject.equals(Subject.training_card)) {
            return MyApp.getInstance().getStringById(R.string.training_card);
        } else if (subject.equals(Subject.private_course)) {
            return MyApp.getInstance().getStringById(R.string.personal_trainer);
        } else if (subject.equals(Subject.special_topic)) {
            return MyApp.getInstance().getStringById(R.string.special_topic);
        } else {
            return "";
        }
    }


    public static String getSubjectNameForCustomMsg(String subject) {
        if (subject.equals(dynamic) || subject.equals(Subject.article) || subject.equals(Subject.major_course)) {
            return MyApp.getInstance().getStringById(R.string.global_search_group_dynamic);
        } else if (subject.equals(Subject.video_course) || subject.equals(Subject.video)) {
            return MyApp.getInstance().getStringById(R.string.video);
        } else if (subject.equals(Subject.photo)) {
            return MyApp.getInstance().getStringById(R.string.publish_photo);
        }
        return MyApp.getInstance().getStringById(R.string.global_search_group_dynamic);
    }

    public static List<String> getDynamicSubjects() {
        return Arrays.asList(Subject.photo, Subject.video, Subject.article,Subject.activity);
    }

    public static List<String> getGlobalSubjects() {
        return Arrays.asList(Subject.photo, Subject.video, Subject.video_course, Subject.article,Subject.special_topic,
                Subject.major_course);
    }

    public static List<String> getMyBuySubjects() {
        return Arrays.asList(Subject.video_course, Subject.major_course, Subject.training_course);
    }

    public static boolean isVideo(String subject) {
        if (TextUtils.isEmpty(subject)) {
            return false;
        }
        if (subject.equals(Subject.video_course) || subject.equals(Subject.video)) {
            return true;
        }
        return false;
    }

}
